package net.appportal.ant.tasks;

import java.util.Vector;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.TaskContainer;

/**
 * 
 * @author Administrator
 *
 */
public class DotNetAspxCompile extends Task implements TaskContainer
{
	private Vector tasks = new Vector();
	private String value = "";
	private String name = null;
	private String delimeter = "";
	private String indexof = null;
	private String replace = null;
	private String verbose = null;
   
	/**
	 * 
	 *
	 */
	public DotNetAspxCompile()
	{
		
	}
	
	/**
	 * 
	 * @param name
	 */
	public void setName( String name )
	{
		this.name = name;
	}

	/**
	 * 
	 * @param value
	 */
	public void setAppend( String value )
	{
		this.value = value;
	}
	
	/**
	 * 
	 * @param replace
	 */
	public void setReplace( String replace )
	{
		this.replace = replace;
	}
	
	/**
	 * 
	 * @param replace
	 */
	public void setIndexof( String indexof )
	{
		this.indexof = indexof;
	}
	
//	/**
//	 * 
//	 * @param replace
//	 */
//	public void setReplace( String replace )
//	{
//		this.replace = replace;
//	}	
	
	/**
	 * 
	 * @param delimeter
	 */
	public void setDelimeter( String delimeter )
	{
		this.delimeter = delimeter;		
	}
	
	/**
	 * 
	 */
	public void execute() throws BuildException 
	{
		if ( name == null || name.equals( "" ) ) 
			throw new BuildException( "The 'name' attribute is required with 'stringbuilder'." );
		
		String prevValue = getProject().getProperty(name);
		String newValue = prevValue + value + delimeter;
		getProject().setProperty(name,newValue);
		
		System.out.println("newValue : "+ newValue);
	}

	public void addTask( Task task ) 
	{
	      tasks.addElement( task );		
	}
}
